#

| Chapter 20 Backing Up Files |

## 20.5 Using tar to a Remote Tape Drive

If your computer doesn't have a tape drive connected, creating tar (20.1) backup files is slightly more complicated. If you have an account on a machine with a tape drive, and the directory is mounted via NFS (1.33), you can just rlogin (1.33) to the other machine and use tar to back up your directory.

If the directory is not NFS mounted, or it is mounted but you have permission problems accessing your own files, you can use tar, rsh (1.33), and dd (35.6) to solve this dilemma. The syntax is confusing, but if you forget, you can use man tar (50.1) to refresh your memory. The command to dump the current directory to a tape in a remote machine called zephyrus is:

>     % tar cvfb - 20 . | rsh zephyrus dd of=/dev/rmt0 obs=20b

Here, the output file of tar is `-` (13.13), which tar interprets as standard input if tar is reading an archive or standard output if tar is creating an archive.

The dd command copies data from standard input to the device /dev/rmt0. Article 20.6 explains more about how this works.

This example assumes you can use rsh without requiring a password. You can add your current machine's name to the remote .rhosts file (1.33) if you get a `Password:` prompt when you use rlogin to access this machine.

- BB

20.4 Restoring Files from Tape with tar |  | 20.6 Writing a Tape Drive on a Remote Machine